package com.css.common.core.enums;

import com.css.common.core.constant.AppCons;
import com.css.common.core.constant.FpkjztEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @description: 订单开票状态
 * @Title: OrderKpStatusEnum
 * @Author xlw
 * @Package com.invoice.tcc.enums
 * @Date 2024/8/14 18:22
 */
@Getter
@AllArgsConstructor
public enum OrderKpStatusEnum {

    UNKNOWN(0, "待开票"),

    LP_CG(1, "蓝票开具成功"),

    LP_SB(2, "蓝票开具失败"),

    HP_CG(3, "红票开具成功"),

    HP_SB(4, "红票开具失败"),

    KP_SUBMIT(5, "开票待提交"),

    ;
    private Integer dm;

    private String ms;

    public static OrderKpStatusEnum kpjgToEnum(int kpjg, int fpType) {
        if (FpkjztEnum.FPKJZT_DKJ.getType() == kpjg || FpkjztEnum.FPKJZT_KJZ.getType() == kpjg) {
            return UNKNOWN;
        }

        if (FpkjztEnum.FPKJZT_KJSB.getType() == kpjg || FpkjztEnum.FPKJZT_CX_EXCEPTION.getType() == kpjg
                || FpkjztEnum.FPKJZT_KJ_EXCEPTION.getType() == kpjg) {
            return AppCons.FP_TYPE_LP == fpType ? LP_SB : HP_SB;
        }

        if (FpkjztEnum.FPKJZT_KJCG.getType() == kpjg) {
            return AppCons.FP_TYPE_LP == fpType ? LP_CG : HP_CG;
        }
        return UNKNOWN;
    }
}
